#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    worker = new mwworker(this);
    connect(worker, SIGNAL(ShowStatus(string)), this, SLOT(ShowStatus(string)));

    worker->start();
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::ShowStatus(string s)
{
    QString qs;

    qs = qs.fromStdString(s);
    statusBar()->showMessage(qs, 2000);
}

void MainWindow::ShowTip(QString s)
{
    ui->tip->appendPlainText(s);
}

void MainWindow::on_mencibihe_clicked()
{
    worker->msgq_push(1);
}

void MainWindow::on_menciduankai_clicked()
{
    worker->msgq_push(2);
}

void MainWindow::on_dengbihe_clicked()
{
    worker->msgq_push(3);
}

void MainWindow::on_dengduankai_clicked()
{
    worker->msgq_push(4);
}

void MainWindow::on_chaxun1_clicked()
{
    worker->msgq_push(5);
}

void MainWindow::on_yl1bihe_clicked()
{
    worker->msgq_push(6);
}
